/*
 *
 * 名称：八卦
 * 功能：易经的基本八卦功能
 * 作者：清河张
 * 时间：2025.05.11
 *
 */

#include "gua8.h"


bool DANGUA_T::XIANG::invalid() const
{
    return _a || _b;
}

DANGUA_T::XIANG::XIANG(unsigned v):
    _v(v)
{
}

DANGUA_T::XIANG::XIANG(unsigned y1, unsigned y2, unsigned y3, unsigned a, unsigned b):
    _v(0)
{
    _1 = y1;
    _2 = y2;
    _3 = y3;

    _a = a;
    _b = b;
}


template <> DANGUA_T GUA8PARENT::_objs[9] =
{
    {DANGUA_T::ZGUA, "中", "空", 0, 0, 0,1,1},
    {DANGUA_T::QIAN, "乾", "天", 1, 1, 1,0,0},
    {DANGUA_T::DUII, "兑", "泽", 1, 1, 0,0,0},
    {DANGUA_T::LIII, "离", "火", 1, 0, 1,0,0},
    {DANGUA_T::ZHEN, "震", "雷", 1, 0, 0,0,0},
    {DANGUA_T::SHUN, "巽", "风", 0, 1, 1,0,0},
    {DANGUA_T::KANN, "坎", "水", 0, 1, 0,0,0},
    {DANGUA_T::GENN, "艮", "山", 0, 0, 1,0,0},
    {DANGUA_T::KUNN, "坤", "地", 0, 0, 0,0,0},
};


DANGUA_T::DANGUA_T():
    CT(G___, "中"),
    _xiang(0), _wname("空")
{
}


DANGUA_T::DANGUA_T(int id, const char *name, const char* wname, unsigned y1, unsigned y2, unsigned y3, unsigned a, unsigned b):
    CT(id, name), _xiang(y1,y2,y3,a,b), _wname(wname)
{

}

DANGUA_T::XIANG DANGUA_T::xiang() const
{
    return _xiang;
}

const char *DANGUA_T::wname() const
{
    return _wname;
}

GUA8::GUA8():
    GUA8PARENT(-1)
{

}

GUA8::GUA8(int id):
    GUA8PARENT(id)
{

}

GUA8::GUA8(const DANGUA_T &gua8)
    : GUA8PARENT (gua8)
{

}

GUA8::GUA8(const GUA8PARENT &parent):
    GUA8PARENT (parent)
{

}

GUA8 &GUA8::operator = (const GUA8PARENT &gua8)
{
    GUA8PARENT::operator = (gua8);
    return *this;
}


GUA8 &GUA8::operator = (const DANGUA_T &gua8)
{
    GUA8PARENT::operator = (gua8);
    return *this;
}

GUA8 &GUA8::operator =(int id)
{
    GUA8PARENT::operator =(id);
    return *this;
}
